package nc.ui.erm.fktj;

import nc.lfw.billtemplate.delegator.IBusinessDelegator;
import nc.lfw.billtemplate.processor.DefaultBillTemplateProcessor;
import nc.lfw.data.Dataset;
import nc.lfw.data.PaginationInfo;
import nc.lfw.util.LfwClassUtil;
import nc.md.data.access.NCObject;
import nc.md.model.IBusinessEntity;
import nc.vo.pub.BusinessException;

public class FKTjProcessor extends DefaultBillTemplateProcessor {

	@Override
	protected IBusinessDelegator createBusiDelegator() {
		String delegator = FKTjDelegator.class.getName();
		return (IBusinessDelegator) LfwClassUtil.newInstance(delegator);
	}

	@Override
	protected NCObject[] doBillLoad(IBusinessEntity entity)
			throws BusinessException {
		FKTjDelegator delegator =  new FKTjDelegator();
		Dataset ds = this.getWebContext().getPageMeta().getViewModel().getDataset("tjqb_QbTjVo");
		PaginationInfo pInfo = null;
		if(ds != null){
			pInfo = ds.getPaginationInfo();	
		}
		String pk_todolist = this.getWebContext().getParameter("pk_todolist");
		String strWhere = " 1=1 ";
		if(null != pk_todolist && !"".equals(pk_todolist)){
			strWhere = " 1=1 and bz.zyx30='"+pk_todolist+"'";
		}
		NCObject[] s = delegator.queryHeadAllData(entity,
				 "",  strWhere, pInfo);;
		
		return s;
	}

	private FKTjDelegator getDelegator() {
		FKTjDelegator delegator = (FKTjDelegator) this.billHandler;
		return delegator;
	}
}
